Skip to content

fix(workspace): Bury Pane targets visible Dispatch row - #109

Merged
Juliusolsson05 merged 1 commit into
mainfrom
fix/bury-dispatch-aware
May 14, 2026
Merged

Juliusolsson05 merged 1 commit into
mainfrom
fix/bury-dispatch-aware

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

Summary

Closes the action-layer half of #94. `requestBuryFocused` was the last grid-only action surfaced by the audit — every other "focused" verb either routes through `commandTargetSessionIdForState` already (close, scroll-to-latest, switch-provider, reload, soft-reload, copy-assistant, tail-mode, rewind) or is intentionally grid-only by design (split, navigate, resize, detach-from-grid, undo-close).

Now `requestBuryFocused` uses the same Dispatch-aware resolver so "Bury Pane" acts on the highlighted Dispatch row instead of whatever grid pane is focused underneath.

What the bug looked like

  1. User is in Dispatch Mode.
  2. Dispatch row N is highlighted (could be detached agent X).
  3. Grid focus underneath is still pane Y.
  4. User runs Bury Pane.
  5. Old behaviour: bury prompt opens for Y. Confirm = wrong session buried.
  6. New behaviour: bury prompt opens for X.

Sites changed

`src/renderer/src/workspace/hook/actions/pane.ts`:

  • `requestBuryFocused` resolves target through `commandTargetSessionIdForState` before calling `openBuryPrompt`.
  • `buryFocused` keeps its `?? activeTab?.focusedSessionId` fallback but tags it with a thick WHY comment so future-me doesn't promote it to the primary path.

One file, 25 insertions / 5 deletions.

Audit trail

PR #107 closed the view-layer half of #94 (which sessions are in a tab). The action-layer audit done as part of this PR confirmed that the rest of `workspace/hook/actions/` — provider, helpers, session, reader, spotlight, dispatch, undoClose — is already either Dispatch-aware via `commandTargetSessionIdForState` or correctly grid-only by design. `requestBuryFocused` was the lone holdout.

Test plan

  • `npm run test:review-fixes` passes
  • `npm run test:work-context` passes
  • Manual: enter Dispatch Mode → highlight a detached row (not the grid pane) → run Bury Pane → confirm the modal targets the detached session

Closes

🤖 Generated with Claude Code

requestBuryFocused was the last grid-only action surfaced by issue
#94's audit. It read tab.focusedSessionId directly, so "Bury Pane"
from Dispatch Mode buried whichever grid pane happened to be focused
underneath the visible dispatch row instead of acting on the row
the user could see.

Resolves the target through commandTargetSessionIdForState — the
same resolver every other "act on the visible thing" command
already uses (close, copy-assistant, scroll-to-latest,
switch-provider, reload, rewind, soft-reload-view).

Also adds a WHY comment on buryFocused's `?? activeTab?.focusedSessionId`
fallback to flag it as intentional defensive code rather than a
load-bearing path — every real caller passes an explicit id, but
the fallback exists so a future caller that forgets fails loudly
instead of silently dispatching to the wrong session.

After this commit, the action-layer half of #94 is closed: every
"focused" action either routes through commandTargetSessionIdForState
or is intentionally grid-only by design (split, navigate, resize,
detach-from-grid, undo-close).

Closes #94.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Juliusolsson05
Juliusolsson05 merged commit bc267ee into main May 14, 2026
@Juliusolsson05
Juliusolsson05 deleted the fix/bury-dispatch-aware branch July 7, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Commands target grid-only sessions — dispatch agents recurringly fall through every command path

1 participant